﻿<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>用户注册</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <div th:include="layout/resources :: resources"></div>
</head>
<body>
<div class="container">
    <form role="form">
        <div class="form-group">
            <label for="userName">用户名</label>
            <input type="text" class="form-control" id="userName" name="userName" placeholder="请输入用户名">
        </div>
        <div class="form-group">
            <label for="password">密码</label>
            <input type="text" class="form-control" id="password" name="password" placeholder="请输入密码">
        </div>
        <button type="button" onclick="register();" class="btn btn-default">注册</button>
    </form>
</div>


</body>
<script>
    function register() {
        $.ajax({
            url: createUrl("/user/add"),
            data: $("form").serialize(),
            success: function (result) {

                if (result.success) {
                    framework.alert("注册成功");
                } else {
                    framework.alert("注册失败");
                }
            }
        })
    }
</script>
</html>
